Skip to content

slider: handle mouse wheel events#2565

Merged
hecrj merged 3 commits into
iced-rs:masterfrom
kiedtl:slider_mouse_wheel
Sep 13, 2024
Merged

slider: handle mouse wheel events#2565
hecrj merged 3 commits into
iced-rs:masterfrom
kiedtl:slider_mouse_wheel

Conversation

@kiedtl

@kiedtl kiedtl commented Sep 2, 2024

Copy link
Copy Markdown
Contributor

Make slider + vertical_slider handle mouse wheel events -- i.e. when hovered, scrolling the mouse wheel will modify the slider.


Question: currently the slider is incr/decremented by self.step for both ScrollDelta::Pixels and ScrollDelta::Lines. This seems appropriate for Lines, but I'm not sure about Pixels. (It felt fine to me when testing, but I'm not sure what the "expected" behaviour is.)

@hecrj hecrj added this to the 0.13 milestone Sep 13, 2024
@hecrj hecrj added feature New feature or request widget addition labels Sep 13, 2024

@hecrj hecrj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I made a change to only enable slider scrolling when the Ctrl modifier is pressed. This way, we avoid accidental slider changes when inside a scrollable.

@hecrj hecrj enabled auto-merge September 13, 2024 21:48
@hecrj hecrj merged commit f3b51e4 into iced-rs:master Sep 13, 2024
@kiedtl

kiedtl commented Sep 13, 2024

Copy link
Copy Markdown
Contributor Author

Oh. I was trying to emulate Windows-specific behavior here, specifically the app I was replacing with my Iced project. Of course, users can adjust, but the initial friction will be there.

So I suppose there's no way for a widget inside another to prevent the outer widget from capturing its events?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition feature New feature or request widget

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants